Skip to content

Preserve jvm.gc.name attribute in AppSignals GC runtime metrics - #2218

Merged
jefchien merged 4 commits into
aws:mainfrom
ezhang6811:fix/preserve-jvm-gc-name-dimension
Jul 31, 2026
Merged

Preserve jvm.gc.name attribute in AppSignals GC runtime metrics#2218
jefchien merged 4 commits into
aws:mainfrom
ezhang6811:fix/preserve-jvm-gc-name-dimension

Conversation

@ezhang6811

@ezhang6811 ezhang6811 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserves the name label (which carries the jvm.gc.name OTel attribute) on the aggregate JVMGCCount and JVMGCDuration AppSignals runtime metrics, enabling downstream consumers to differentiate GC collector types.

Problem

The JVMGCCount and JVMGCDuration transform rules in appsignals_runtime_config.yaml used label_set: [] in their aggregate_labels operation, which stripped all labels including the name attribute that identifies the GC collector type (e.g. PS Scavenge, G1 Young Generation).

Changes

  • Changed label_set: [] to label_set: ["name"] for both JVMGCCount and JVMGCDuration transform rules
  • Added unit test (TestAppSignalsGCMetricsPreserveNameLabel) that validates the name label is preserved

Testing

  • Unit tests pass
  • E2E: built A/B agent binaries (main vs. this branch) on EC2, ran both against a Java app using Parallel GC with ADOT instrumentation. Baseline EMF has no name field; this branch emits the name attribute on every GC record in CloudWatch Logs.

Example EMF record from the /aws/application-signals/data log group:

{
  "Environment": "eks:demo/default",
  "Service": "pet-clinic-frontend-java",
  "Telemetry.Source": "RuntimeMetric",
  "name": "PS Scavenge",
  "JVMGCCount": 7,
  "JVMGCDuration": 74,
  "_aws": {
    "CloudWatchMetrics": [{
      "Namespace": "ApplicationSignals",
      "Dimensions": [["Environment", "Service"]],
      "Metrics": [
        {"Name": "JVMGCCount", "Unit": "", "StorageResolution": 60},
        {"Name": "JVMGCDuration", "Unit": "", "StorageResolution": 60}
      ]
    }]
  }
}

The JVMGCCount and JVMGCDuration transform rules were stripping all
labels (label_set: []) during aggregation, which discarded the 'name'
attribute (jvm.gc.name) that identifies the GC collector type.

This change preserves the 'name' label on these aggregate GC metrics
so the Topology service can distinguish between different GC collector
types (e.g. G1, Parallel, CMS, ZGC) when generating per-collector
runtime metrics.

Resolves: P476745637, D482737053
@ezhang6811
ezhang6811 requested a review from a team as a code owner July 27, 2026 19:44
@ezhang6811
ezhang6811 force-pushed the fix/preserve-jvm-gc-name-dimension branch from 569613e to bf4fb6c Compare July 28, 2026 00:00
Update the expected YAML output in tocwconfig sample configs to
reflect the label_set: [name] change on JVMGCCount and JVMGCDuration.
@ezhang6811
ezhang6811 force-pushed the fix/preserve-jvm-gc-name-dimension branch from 5fb9108 to 86ab6df Compare July 28, 2026 22:48
@jefchien
jefchien merged commit 4753aac into aws:main Jul 31, 2026
30 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants